package com.punai.config.sqlitesetting;


import com.punai.common.utils.sqlite.SqliteUtil;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;


@Component
@ConfigurationProperties(prefix = "sqlite")
public class SqliteSystemTemplConnection {

    private SqliteUtil sqliteUtil;

    private String dataSource;

    public void setSqliteUtil(SqliteUtil sqliteUtil) {
        this.sqliteUtil = sqliteUtil;
    }

    public String getDataSource() {
        return dataSource;
    }

    public void setDataSource(String dataSource) {
        this.dataSource = dataSource;
    }

    public SqliteUtil initConnection() {
        if (sqliteUtil == null) {
            sqliteUtil= new SqliteUtil();
            sqliteUtil.getConnection(dataSource);
        }
        return sqliteUtil;
    }

    public SqliteUtil getSqliteUtil() {
        return sqliteUtil;
    }


}
